<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<?
require_once("model/lang_vn.php");
?>
<head><title>

</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<link href="<?=PATH_HTTP?>phimhd/style.css" rel="stylesheet" type="text/css">

<body>

    <form name="form1" method="post" action="<?=PATH_HTTP?>page.php" id="form1">
<?
	error_reporting(0);
	session_start();
	require "model/config.php";
	require "model/sql.class.php";
	require "view/pub.class.php";	
	$sql=new sql();
	$pub=new pub();
	$sql->CONNECT_DB(HOST,USER,PASS,DB);
	$mv_ID	= $_REQUEST['Catch_Id'];
	$mv_hdd = $_REQUEST['mv_hdd'];
	if(($mv_ID>0)&&($mv_hdd>0)){		
		$m_result1 = mysql_query("DELETE FROM movie_tpm WHERE mv_ID='0'");
		$result = mysql_query("SELECT * FROM movie_tpm WHERE mv_ID='".$mv_ID."' AND tpm_session='".$_SESSION['hd308']."'");
		if(mysql_num_rows($result)<=0){				
				$m_result = mysql_query("INSERT INTO movie_tpm(tpm_session,mv_ID,mv_hdd,tpm_date) VALUES('".$_SESSION['hd308']."','".$mv_ID."','".$mv_hdd."','".date('Y/m/d')."')");		
		}else{
				$m_result2 = mysql_query("DELETE FROM movie_tpm WHERE mv_ID='".$mv_ID."'  AND tpm_session='".$_SESSION['hd308']."'");
		}
	}
	$results = mysql_query("SELECT SUM(mv_hdd) as tong FROM movie_tpm WHERE tpm_session='".$_SESSION['hd308']."' AND mv_ID>0 GROUP BY mv_ID,tpm_session");
	
	$mhdd = 0;
	while ($k=mysql_fetch_array($results)) {		
		$mhdd = $mhdd + $k['tong'];

	}
	$percen = $mhdd/2000*100;
	$result2 = mysql_query("SELECT COUNT(mv_hdd) as soluong FROM movie_tpm WHERE tpm_session='".$_SESSION['hd308']."' AND mv_ID>0 GROUP BY mv_ID,tpm_session");
	$soluong = mysql_num_rows($result2)	;
?>
<div>
<div class="total_wrap">
	<div class="total">
    	<div class="left">
        	<div class="count"><span id="percent" style="width: <?=$percen?>%; display: block; "></span></div>
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tbody><tr>
                        <td width="25%" align="left">0</td>
                        <td width="25%" align="left">500 GB</td>
                        <td width="25%" align="left">1 T</td>
                        <td width="15%" align="left">1500 GB</td>
                        <td width="10%" align="right">2 TB</td>
                    </tr>
                </tbody></table>
        </div>
        <div class="right">
        	
                <table width="100%" cellpadding="0" cellspacing="0" style="margin-top:2px;">
                    <tbody><tr>
                        <td width="41%" valign="bottom"><strong>TỔNG : <span id="size" style="color:#FF0000; "><?=$mhdd?></span> GB<br />Số phim : <?=$soluong?></strong></td>
                        <!--<td width="18%" valign="bottom"><a href="<?=PATH_HTTP?>MovieOrder/"><img src="<?=PATH_HTTP?>images/btn_fin.jpg" border="0"></a></td>!-->
						<td width="18%" valign="bottom"><a href="<?=WEBSITE?>/?cc=cart_movie"><img src="<?=PATH_HTTP?>images/btn_fin.jpg" border="0"></a></td>						
                    </tr>
                </tbody></table>
        	</div>
           </div>
</div>
</form>

</body>

</html>
